HashMap = function(){  
    this.map = new Object();
};

HashMap.prototype = {  
    put : function(key, value) {  
        this.map[key] = value;
    }
	,get : function(key) {  
        return this.map[key];
    }
	,getAll : function() {  
        return this.map;
    }
	,clear : function() {  
		for ( var prop in this.map ) {
		      delete this.map[prop];
		}
    }
	,remove : function(key) {
		delete this.map[key];
	}
	,containsKey : function(key){    
		return key in this.map;
	}
	,getKeys : function() {  
        var keys = new Array();  
        for ( i in this.map ) {  
            keys.push(i);
        }  
        return keys;
    }
	,size : function() {
		var count = 0;
		for ( var prop in this.map ) {
			count++;
		}
		return count;
	}
};

var StringBuffer = function() {
	this.buffer = new Array();
};

StringBuffer.prototype = {
	append : function(str) {
		this.buffer[this.buffer.length] = str;
	}
	,toString : function() {
		return this.buffer.join("");
	}
};

var clientMap 	= new HashMap();
var projectMap 	= new HashMap();
var subMenuMap	= new HashMap();

var mainLayout;
var headerToolbar;
var topologyLayout;
var boardLayout;

window.onload = function() {
	dhtmlx.image_path = IMAGE_PATH;
	
	mainLayout 		= new dhtmlXLayoutObject('mainDiv', '2U', 'dhx_web');
	headerToolbar 	= mainLayout.attachToolbar();
	
	headerToolbar.attachEvent('onClick', function(id) {
		switch ( id ) {
		case 'logo' :
			boardLayout.setText(COMMON_TITLE);
			initTree();
			break;
		case 'login' :
			headerToolbar.setItemText(id, '로그아웃');
			break;
		case 'join' :
			break;
		}
	});
	headerToolbar.loadStruct([
	                          {id:'logo', type:'button', text:'NEO ARENA 통합문서서버', img:IMAGE_PATH + '/custom_imgs/file.gif'}
	                          ,{id:'login', type:'button', text:'로그인'}
	                          ,{id:'join', type:'button', text:'회원가입'}
	                          ]);
	headerToolbar.addSpacer('logo');
	headerToolbar.setIconSize(32);
	
	topologyLayout = mainLayout.cells('a');
	topologyLayout.setText('Topology');
	topologyLayout.setWidth('250');
	
	boardLayout = mainLayout.cells('b');
	boardLayout.setText(COMMON_TITLE);
	
	initTree();
};